package com.ashin.entity;

import lombok.Data;
import org.springframework.data.neo4j.core.schema.Id;
import org.springframework.data.neo4j.core.schema.Node;
import org.springframework.data.neo4j.core.schema.Relationship;

import java.util.HashSet;
import java.util.Set;

import static org.springframework.data.neo4j.core.schema.Relationship.Direction.OUTGOING;

/**
 * @author Ashin
 */
@Node("Person")
@Data
public class PersonEntity {

    @Id
    private final String name;

    private final Integer born;

    @Relationship(type = "ACTED_IN", direction = OUTGOING)
    private Set<PersonEntity> actors = new HashSet<>();

    @Relationship(type = "DIRECTED", direction = OUTGOING)
    private Set<PersonEntity> directors = new HashSet<>();

    public PersonEntity(Integer born, String name) {
        this.born = born;
        this.name = name;
    }
}
